<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <input type="text" v-model="val" />
      {{val}}

      <ol>
        <li v-for="(item,index)  of goods">
          <input type="checkbox" v-model="select" :value="item.goodsName" />
          <b>{{item.goodsName}}</b>
        </li>
      </ol>
      <h6>{{select}}</h6>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
    <script>
      //number  转换成number类型
      //trim 去除字符串俩边的空白
      //lazy 内容变更 变成惰性的

      //v-model
      //在列表中使用
      //当值多的时候必须写成数组
      const vm = new Vue({
        el: "#app",
        data: {
          val: "",
          select: [],
          goods: [
            {
              id: 1,
              goodsName: "年夜饭",
              price: 2999,
            },
            {
              id: 2,
              goodsName: "美特斯邦威",
              price: 299,
            },
            {
              id: 3,
              goodsName: "古驰",
              price: 29999,
            },
            {
              id: 4,
              goodsName: "香奈儿",
              price: 299999,
            },
          ],
        },
        methods: {},
      });
    </script>
  </body>
</html>
